2d3fae
@@ -339,7 +339,8 @@
private void updateSessionTriggerProvidersOnMasterThread() {
     private WMFullResourcePlan resourcePlanToApply = null;
     private boolean doClearResourcePlan = false;
     private boolean hasClusterStateChanged = false;
-    private SettableFuture<Boolean> testEvent, applyRpFuture;
+    private List<SettableFuture<Boolean>> testEvents = new LinkedList<>();
+    private SettableFuture<Boolean> applyRpFuture;
     private SettableFuture<List<String>> dumpStateFuture;
     private final List<MoveSession> moveSessions = new LinkedList<>();
   }
@@ -401,10 +402,11 @@
private void runWmThread() {
         return;
       } catch (Exception | AssertionError ex) {
         LOG.error("WM thread encountered an error but will attempt to continue", ex);
-        if (currentEvents.testEvent != null) {
-          currentEvents.testEvent.setException(ex);
-          currentEvents.testEvent = null;
+        for (SettableFuture<Boolean> testEvent : currentEvents.testEvents) {
+          LOG.info("Failing test event " + System.identityHashCode(testEvent));
+          testEvent.setException(ex);
         }
+        currentEvents.testEvents.clear();
         if (currentEvents.applyRpFuture != null) {
           currentEvents.applyRpFuture.setException(ex);
           currentEvents.applyRpFuture = null;
@@ -721,12 +723,14 @@
private void processCurrentEvents(EventState e, WmThreadSyncWork syncWork) throw
       e.dumpStateFuture.set(result);
       e.dumpStateFuture = null;
     }
-    
+
     // 15. Notify tests and global async ops.
-    if (e.testEvent != null) {
-      e.testEvent.set(true);
-      e.testEvent = null;
+    for (SettableFuture<Boolean> testEvent : e.testEvents) {
+      LOG.info("Triggering test event " + System.identityHashCode(testEvent));
+      testEvent.set(null);
     }
+    e.testEvents.clear();
+
     if (e.applyRpFuture != null) {
       e.applyRpFuture.set(true);
       e.applyRpFuture = null;
@@ -1552,7 +1556,8 @@
private void addKillQueryResult(WmTezSession toKill, boolean success) {
     SettableFuture<Boolean> testEvent = SettableFuture.create();
     currentLock.lock();
     try {
-      current.testEvent = testEvent;
+      LOG.info("Adding test event " + System.identityHashCode(testEvent));
+      current.testEvents.add(testEvent);
       notifyWmThreadUnderLock();
     } finally {
       currentLock.unlock();
